<template>
  <div class="reg_">
    <!-- <p>
      <input type="text" placeholder="用户名" v-model="username" />
    </p>
    <p>
      <input type="text" placeholder="密码" v-model="password" />
    </p>
    <p>
      <input type="text" placeholder="确认密码" v-model="password1" />
    </p>
    <p>
      <input type="text" placeholder="验证码" />
    </p>
    <p>
      <input type="button" value="注册" />
    </p>-->
    <!-- <div class="tips">{{msg}}</div> -->

    <van-cell-group :border="false">
      <van-field v-model="tel" placeholder="手机号/账户名/邮箱" />
    </van-cell-group>
    <van-button
      round
      type="info"
      color="linear-gradient(to right, #ff6034, #ee0a24)"
      @click="goNext"
    >下一步</van-button>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "Register",
  // data() {
  //   return {
  //     username: "01001",
  //     password: "123666",
  //     password1: "123666",
  //     code: "",
  //     randomCode: "",
  //     msg: ""
  //   };
  // },
  // created() {
  //   this.getRandomCode();
  // },
  // methods: {
  //   getRandomCode() {
  //     let str = "";
  //     for (let i = 0; i < 4; i++) {
  //       str += parseInt(Math.random() * 10);
  //     }
  //     this.randomCode = str;
  //   }
  // }

  data() {
    return {
      tel: ""
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    goNext() {
      axios({
        method: "post",
        url: "http://121.89.205.189:3001/api/user/docheckphone",
        data:`tel=${this.tel}`
      }).then(res => {
        if (res.data.code == 200) {
          localStorage.setItem("tel", this.tel);
        }
      });
      this.$router.push('/reg/sms')
    }
  }
};
</script>

<style scoped>
p > input {
  width: 18.75rem;
  height: 1.875rem;
  border: 1px solid gray;
  border-radius: 1.25rem;
  padding-left: 0.125rem;
  margin: 0.625rem 2.1875rem;
}
.tips {
  margin: 0 auto;
  text-align: center;
}

.van-button {
  margin: 1rem;
  width: 90%;
  /* margin: 1.25rem auto; */
}
</style>